home *** CD-ROM | disk | FTP | other *** search
- unit Globals;
-
- {Global declarations for Image program.}
-
- interface
-
- uses
- QuickDraw, PrintTraps;
-
- const
- Version = 116;
-
- const
- AppleMenu = 128;
- FileMenu = 129;
- EditMenu = 130;
- OptionsMenu = 131;
-
- FunctionsMenu = 132;
- SmoothItem = 1;
- SharpenItem = 2;
- EdgeDetectItem = 3;
- ReduceNoiseItem = 4;
- DitherItem = 5;
- ConvolveItem = 6;
- PhotoModeItem = 8;
- AnimateItem = 9;
- EnhanceItem = 10;
- EqualizeItem = 11;
- ApplyItem = 12;
- BinaryItem = 13;
- ChangeItem = 14;
- SortItem = 15;
- UnZoomItem = 16;
- StartItem = 18;
- AverageItem = 19;
- SetVideoItem = 20;
-
- BinaryMenu = 35; {Sub Menu}
- MakeBinaryItem = 1;
- ErosionItem = 3;
- DilationItem = 4;
- OpeningItem = 5;
- ClosingItem = 6;
- OutlineItem = 8;
- SkeletonizeItem = 9;
-
- AnalysisMenu = 133;
- MeasureItem = 1;
- ShowItem = 2;
- OptionsItem = 3;
- HistogramItem = 4;
- PlotItem = 5;
- Plot3DItem = 6;
- SaveBlankFieldItem = 8;
- SetScaleItem = 9;
- CalibrateItem = 10;
- ResetItem = 11;
- RestoreItem = 12;
- NumberSelectionItem = 13;
-
- TextMenu = 134;
- LeftItem = 5;
- CenterItem = 6;
- RightItem = 7;
- NoBackgroundItem = 9;
- WithBackgroundItem = 10;
-
- FontMenu = 32; {Sub Menus}
- SizeMenu = 33;
- StyleMenu = 34;
-
- WindowsMenu = 138;
-
- UserMenu = 139;
-
- HeaderSize = 512;
- TiffDirSize = 256;
- MaxPixelsPerLine = 2048;
- tleft = 36;
- ttop = 40;
- twidth = 44;
- tmiddle = 22;
- theight = 277;
- gmleft = 2;
- gmtop = 338;
- gmwidth = 78;
- gmheight = 118;
- gmRectLeft = 7;
- gmRectTop = 6;
- gmRectRight = 71;
- gmRectBottom = 70;
- gmSlideWidth = 68;
- gmSlideHeight = 7;
- gmSlide1Offset = 8;
- gmSlide2Offset = 19;
- gmIconWidth = 17;
- gmIconHeight = 14;
- gmIconOffset = 31;
- gmIcon1Left = 17;
- gmIcon2Left = 46;
- cleft = 2;
- ctop = 40;
- cwidth = 30;
- rwidth = 200;
- rheight = 175;
- hleft = 220;
- hwidth = 256;
- hheight = 120;
- MaxPseudoColors = 32;
- MaxPseudoColorsLessOne = 31;
- PicKind = 88;
- HistoKind = 89;
- ProfilePlotKind = 90;
- LUTKind = 91;
- GrayMapKind = 92;
- ToolKind = 93;
- ResultsKind = 94;
- CalibrationPlotKind = 95;
- PasteControlKind = 96;
- IOErrorID = 400;
- MessageID = 300;
- AboutID = 256;
- VersItem = 2;
- MemItem = 3;
- StackSize = 40000;
- ToolFont = 249; {Bits 7-14 of font resource ID(31884) }
- nItems = 10; {Items in Windows menu before pics}
- MaxPicsInMenu = 21; {31-nItems}
- ho = 2;
- vo = 4;
- WhiteC = 0;
- BlackC = 255;
- OvalSize = 15;
- LinesLeft = 13;
- LinesRight = 40;
- nLinetypes = 6;
- CheckMarkChar = 65;
- TxPlain = 1;
- TxBold = 2;
- TxItalic = 3;
- TxUnderLine = 4;
- TxOutLine = 5;
- TxShadow = 6;
- FileID8 = 'IPICIMAG';
- DefaultBufferSize = 307200; {Enough for 640x480 Pic}
- PickerCursorID = 111;
- LUTCursorID = 112;
- gmCursorID = 113;
- GrabberCursorID = 114;
- PencilCursorID = 115;
- CrossCursorID = 117;
- CrossCursorPlusID = 118;
- CrossCursorMinusID = 119;
- BucketCursorID = 120;
- GlassCursorPlusID = 121;
- GlassCursorMinusID = 122;
- WandCursorID = 123;
- AppleDefaultCLUT = 8;
- SpectrumCLUT = 200;
- KlutzID = 200;
- PixelPaintID = 999;
- GhostWindow = $A84;
- GrayRgnGlobal = $9EE;
- MBarHeight = $BAA;
- MaxPics = 200;
- NoColor = -1;
- FirstExtraColorsEntry = 1;
- MaxExtraColors = 6;
- MaxExtraPlus2 = 8;
- ExtraColorsHeight = 10;
- MyMaxLong = 2000000000;
- MaxTextBufSize = 10000;
- MaxLengths = 100;
- MaxLocs = 500;
- MaxAreas = 200;
- MaxStandards = 20;
- BadReal = 999999.999;
- NoValue = -999999.999;
- TabSpacing = 12;
- MaxPolyVertices = 4000;
- pi = 3.14159265;
- ValuesVStart = 11;
- ValuesHStart = 4;
- {TIFF Constants}
- short = 3;
- long = 4;
- SubFileType = 255;
- ImageWidth = 256;
- ImageLength = 257;
- BitsPerSample = 258;
- Compression = 259;
- PhotoInterp = 262;
- StripOffsets = 273;
- RowsPerStrip = 278;
- ImageHdrTag = -22222; {43314}
- TiffFillerSize = 80;
- RoiHandleSize = 5;
- CancelResetID = 3;
- npcItems = 8;
- blend = 32;
- LeftArrow = 28;
- RightArrow = 29;
- UpArrow = 30;
- DownArrow = 31;
-
- type
- BitMapHandle = ^BitMapPtr;
- BitMapPtr = ^BitMap;
- UnsignedByte = 0..255;
- LineType = packed array[0..MaxPixelsPerLine] of UnsignedByte;
- ClutTable = packed array[0..255] of integer;
- ColorArray = packed array[0..MaxPseudoColorsLessOne] of byte;
- ColorArrayX = packed array[0..MaxPseudoColorsLessOne] of integer;
- PicType = (pdp11, NewPicture, normal, PictFile, Leftover, imported, camera, NullPicture, BlankField, TiffFile, InvertedTIFF, FourBitTIFF, DebugWindow, ScionType);
- LUTModeType = (ColorPalette, AppleDefault, Spectrum, GrayScale, Custom, CustomGrayscale);
- ExtraColorsArray = array[1..MaxExtraColors] of rgbColor;
- MyCSpecArray = array[0..255] of ColorSpec;
- CoefficientArray = array[1..6] of double;
- CurveFitType = (StrightLine, Poly2, Poly3, Poly4, Poly5, ExpoFit, PowerFit, LogFit);
- PicHeader = record
- FileID: packed array[1..8] of char; {8 8}
- hnlines: integer; {2 10}
- hPixelsPerLine: integer; {2 12}
- hversion: integer; {2 14}
- hLutMode: LutModeType; {2 16}
- hnColors: integer; {2 18}
- hr, hg, hb: ColorArray; {96 114}
- hColorStart: integer; {2 116}
- hColorWidth: integer; {2 118}
- hExtraColors: ExtraColorsArray; {36 154}
- hnExtraColors: integer; {2 156}
- hForegroundColor: integer; {2 158}
- hBackgroundColor: integer; {2 160}
- hScale: double; {8 168}
- Unused2: integer; {2 170}
- hUnits: packed array[1..2] of char; {2 172}
- hUnitsID: integer; {2 174}
- hp1x, hp1y, hp2x, hp2y: integer; {8 182}
- hfit: CurveFitType; {2 184}
- hnCoefficients: integer; {2 186}
- hCoeff: CoefficientArray; {48 234}
- hUM: string[15]; {16 250}
- hContainsOutline: boolean; {1 251}
- hBinaryPic: boolean; {1 252}
- UnusedBytes: packed array[1..260] of byte;
- end;
- PicInfo = record
- nlines, PixelsPerLine: integer;
- PicSize: LongInt;
- PicBaseAddr: ptr;
- osPort: cGrafPtr; {Offscreen Port}
- PicRect: rect;
- roiRect, osRoiRect: rect;
- osroiRgn: rgnHandle;
- RoiType: (RgnRoi, RectRoi, OvalRoi, RoundRectRoi, NoRoi);
- SrcRect: rect;
- wrect: rect;
- savewrect: rect;
- RoiShowing: boolean;
- title: string[25];
- NewPic: boolean;
- Magnification: extended;
- vref: integer;
- PictureType: PicType;
- wptr: WindowPtr;
- PicNum: integer;
- ScaleToFitWindow: boolean;
- Changes: boolean;
- nColors: integer;
- RedX, GreenX, BlueX: ColorArrayX;
- ColorStart, ColorWidth: integer;
- LUTMode: LUTModeType;
- cTable: MyCSpecArray;
- BytesPerRow: integer;
- PixMapSize: LongInt;
- Scale: extended;
- units: string[2];
- UnitOfMeasure: string[15];
- UnitsID: integer;
- p1x, p1y, p2x, p2y: integer; {Control points for grayscale transfer function}
- DeltaX, DeltaY: integer;
- HeaderOffset: LongInt;
- ImageDataOffset: LongInt;
- Fit: CurveFitType;
- nCoefficients: integer;
- Coefficient: CoefficientArray;
- Calibrated: boolean;
- BinaryPic: boolean;
- end;
- InfoPtr = ^PicInfo;
- ToolType = (MagnifyingGlass, SelectionTool, Grabber, OvalSelectionTool, Pencil, PolygonTool, Eraser, FreehandTool, Brush, RoundedRectTool, ruler, LUTTool, PaintBucket, TextTool, PlotTool, AirbrushTool, Wand, PickerTool, AngleTool, PointingTool);
- OpType = (InvertOp, PaintOp, FrameOp, EraseOp, PasteOp, AddOp, SubtractOp, MultiplyOp, DivideOp);
- ObjectType = (lineObj, oval, SelectionOval, Rectangle, RoundedRect, PlotLine, SelectionRect, LengthObj, BrushObj);
- FilterType = (WeightedAvg, UnweightedAvg, fsharpen, fshadow, EdgeDetect, ReduceNoise, dither, erosion, dilation, OutlineFilter, skeletonize);
- rhptr = ^RgnHandle;
- FlipRotateType = (RotateLeft, RotateRight, FlipVertical, FlipHorizontal);
- TextJustType = (LeftJust, CenterJust, RightJust);
- TextBackType = (NoBack, WithBack);
- HistogramType = array[0..255] of LongInt;
- str4 = packed array[1..4] of char;
- LookupTable = packed array[0..255] of UnsignedByte;
- TextBufType = packed array[1..MaxTextBufSize] of char;
- SortArray = array[1..9] of integer;
- StandardsArray = array[1..MaxStandards] of extended;
- ResultsType = (NoResults, AreaT, LengthT, PointT);
- MeasurementTypes = (AreaM, MeanM, StdDevM, xyLocM, ModeM, PerimeterM, IntDenM);
- xyArray = array[1..MaxPolyVertices] of integer;
- ValuesModeType = (NoValues, PixelValues, IndexValue, AngleValue, CountValues, WidthValues, xyValues, LengthValues);
- TiffHdr = record
- ByteOrder: packed array[1..2] of char;
- Version: integer;
- FirstIFDOffset: LongInt;
- end;
- TiffEntry = record
- TagField: integer;
- ftype: integer;
- length: LongInt;
- offset: LongInt;
- end;
- pcItemType = (pcRadioButton, pcButton);
- WhatToImportType = (ImportTIFF, ImportMCID, ImportPalette, ImportCustom);
-
- var
- TraceInfo: str4;
- finished: boolean;
- trect, gmrect, GrayMapRect, GrayMapRect2, crect, HistoRect: rect;
- gmSlide1, gmslide2, gmSlide1i, gmSlide2i, gmicon1, gmicon2: rect;
- gmSlide1Loc: integer;
- gmFixedSlope: boolean;
- UpdateRegion: RgnHandle;
- ToolWindow, GrayMapWindow, LUTWindow, ResultsWindow, HistoWindow, PlotWindow, PasteControl: WindowPtr;
- watch: CursHandle;
- Return, tab, BackSpace: char;
- CharCount: LongInt;
- ScreenPort: GrafPtr;
- CScreenPort: cGrafPtr;
- ticks: LongInt;
- MonoFunction: ClutTable;
- PaletteRec: record
- NumberOfColors: integer;
- RedData: ColorArray;
- GreenData: ColorArray;
- BlueData: ColorArray;
- end;
- Info: InfoPtr;
- ToolCursor: array[ToolType] of Cursor;
- PickerCursor, LUTCursor, gmCursor, CrossPlusCursor, CrossMinusCursor, GlassMinusCursor: Cursor;
- CurrentTool, PreviousTool, FirstTool, LastTool: ToolType;
- ToolRect: array[ToolType] of rect;
- ToolChar, ToolCursorChar: array[ToolType] of char;
- ToolTime, LutTime: longInt;
- nPics: integer;
- PicWindow: array[1..MaxPics] of WindowPtr;
- ScreenWidth, ScreenHeight: integer;
- ScreenBase: ptr;
- ScreenRowBytes: LongInt;
- Histogram: HistogramType;
- ForegroundColor, BackgroundColor: integer;
- CurrentColorIndex, ClipColorIndex: integer;
- lines: array[1..nLineTypes] of rect;
- CheckRect: rect;
- LineWidth, LineIndex: integer;
- StartOfLines: integer;
- SaveInfo: InfoPtr;
- MaskRgn: RgnHandle;
- PlotPICT: PicHandle;
- PlotLeft, PlotTop, PlotWidth, PlotHeight: integer;
- PlotMin, PlotMax: extended;
- PlotCount, PlotAvg: integer;
- PlotData: LineType;
- PlotMean: extended;
- InvertPlots, AutoscalePlots, LinePlot, DrawPlotLabels, FixedSizePlot: boolean;
- ProfilePlotMin, ProfilePlotMax: extended;
- ProfilePlotWidth, ProfilePlotHeight: integer;
- UndoBuf, ClipBuf, BigBuf: ptr;
- ClipBufSize, UndoBufSize, BigBufSize: LongInt;
- UndoInfoRec: PicInfo;
- UndoInfo: InfoPtr;
- CurrentUndoSize: LongInt;
- AirbrushDiameter, AirbrushRadius, AirbrushRadius2: integer;
- BrushHeight, BrushWidth: integer;
- Settings: record
- sForegroundColor, sBackgroundColor: integer;
- sBrushHeight, sBrushWidth: integer;
- sAirbrushDiameter: integer;
- sLUTMode: LUTModeType;
- sColorStart, sColorWidth: integer;
- sCurrentFontID: integer;
- sCurrentStyle: style;
- sCurrentSize: integer;
- sTextJust: TextJustType;
- sTextBack: TextBackType;
- snExtraColors: integer;
- sExtraColors: ExtraColorsArray;
- sInvertVideo: boolean;
- sMeasurements: set of MeasurementTypes;
- sInvertPlots, sAutoScalePlots, sLinePlot, sDrawPlotLabels, sFixedSizePlot: boolean;
- sProfilePlotMin, sProfilePlotMax: extended;
- sProfilePlotWidth, sProfilePlotHeight: integer;
- snFrames: integer;
- sNewPicWidth, sNewPicHeight: integer;
- sBufferSize: LongInt;
- sMaxScionWidth: integer;
- sThresholdToForeground, sNonThresholdToBackground: boolean;
- sVideoChannel: integer;
- sWhatToImport: WhatToImportType;
- sImportCustomWidth, sImportCustomHeight: integer;
- sImportCustomOffset: LongInt;
- sWandAutoMeasure, sWandAutoNumber: boolean;
- end;
- CurrentFontID, CurrentSize, NumFontItems: integer;
- CurrentStyle: Style;
- InsertionPoint: point; {Offscreen coordinates}
- IsInsertionPoint: boolean;
- TextJust: TextJustType;
- TextBack: TextBackType;
- TextStr: str255;
- TextRect: rect;
- TextStart: point;
- BlinkTime: LongInt;
- pat: array[0..7] of pattern;
- PatIndex: integer;
- OpPending: boolean;
- CurrentOp: OpType;
- IsOK: boolean;
- PaletteName: string[32];
- PicWindowLeft, PicWindowTop: integer;
- ClipBufInfoRec: PicInfo;
- ClipBufInfo: InfoPtr;
- MouseState: (NotInRoi, InRoi, DownInRoi);
- MouseDownLoc, osMouseDownLoc: point;
- OldRoiRect: rect;
- WhatsOnClip: (Nothing, AColor, RectPic, NonRectPic, ImportedPic);
- PasteMode: (NormalPaste, LiveSelection, PasteFromCamera);
- ExtraColors: ExtraColorsArray;
- nExtraColors: integer;
- PasteTransferMode: integer;
- cheight: integer;
- ExtraColorsRect: array[1..MaxExtraPlus2] of rect;
- ExtraColorsEntry: array[1..MaxExtraPlus2] of integer;
- StretchMode: boolean;
- IdentityFunction: boolean;
- OldScrapCount: integer;
- ScrapNotCleared, ClipboardConverted: boolean;
- results: record
- n: LongInt;
- tmean, x, y, min, max, length, angle: extended;
- hloc, imin, imax, imode, imean: integer;
- end;
- FrameGrabber: (QuickCapture, Scion, NoFrameGrabber);
- DTSlotBase, ScionSlotBase: LongInt;
- ControlReg, ChannelReg: ptr;
- Digitizing: boolean;
- debugging: boolean;
- NoInfo: InfoPtr;
- NoInfoRec: PicInfo;
- BlankLine: LineType;
- UndoFromClip: boolean;
- Thresholding, ThresholdToForeground, NonThresholdToBackground: boolean;
- ThresholdStart, ThresholdEnd: integer;
- ThresholdColor: RGBColor;
- SaveCTable: ^MyCSpecArray;
- BlankFieldInfo: InfoPtr;
- BlankFieldMean: integer;
- CameraInfo, DebugInfo, ScionInfo: InfoPtr;
- InvertVideo: boolean;
- VideoChannel: integer;
- TextBufSize, TextBufColumn, TextBufLineCount: integer;
- TextBufP: ^TextBufType;
- TextOnClip: boolean;
- BitInfoCount: integer;
- nAreas, nAreas2, UnsavedAreas: integer;
- nPoints, UnsavedPoints: integer;
- nLengths, UnsavedLengths: integer;
- Lengths: array[0..MaxLengths] of real;
- TotalLength: real;
- xLoc: array[1..MaxLocs] of integer;
- yLoc: array[1..MaxLocs] of integer;
- mean: array[0..MaxAreas] of real;
- sd: array[0..MaxAreas] of real;
- PixelCount: array[0..MaxAreas] of LongInt;
- mode, IntegratedDensity, plength, xcenter, ycenter: array[0..MaxAreas] of real;
- umean: array[0..MaxStandards] of real; {Uncalibrated means}
- StandardValues: StandardsArray;
- nStandards: integer;
- value: array[0..255] of extended;
- MinValue, MaxValue, FitGoodness, FitSD: extended;
- PlotLeftMargin, PlotTopMargin, PlotBottomMargin, PlotRightMargin: integer;
- WhatToUndo: (NothingToUndo, UndoEdit, UndoFlip, UndoRotate, UndoScale, UndoFilter, UndoPaste, UndoTransform, UndoClear, UndoMeasurement, UndoContrastEnhancement, UndoEqualization, UndoZoom, UndoPlot, UndoOutline);
- WhatToCopy: (NothingToCopy, CopySelection, CopyCLUT, CopyGrayMap, CopyPlot, CopyHistogram, CopyAreas, CopyLengths, CopyPoints, CopyColor);
- WhatToPrint: (NothingToPrint, PrintImage, PrintSelection, PrintAreas, PrintLengths, PrintPoints, PrintPlot, PrintHistogram);
- PrintRecord: THPrint;
- isLaserWriter: boolean;
- printing, ShowingList, Copying: boolean;
- HalftoneFrequency, HalftoneAngle: integer;
- HalftoneDotFunction: boolean;
- AppleMenuH, FileMenuH, EditMenuH, OptionsMenuH, FunctionsMenuH, BinaryMenuH, AnalysisMenuH, TextMenuH, FontMenuH, SizeMenuH, StyleMenuH, WindowsMenuH, UserMenuH: MenuHandle;
- rleft, rtop: integer;
- ListDone: boolean;
- ListWindow: WindowPtr;
- ScrollBar: ControlHandle;
- ListTE: TEHandle;
- ListPageSize: integer;
- ListButton: array[1..4] of rect;
- measuring: boolean;
- Measurements: set of MeasurementTypes;
- nMeasurements: integer;
- ContinuousHistogram: boolean;
- nFrames: integer;
- PixelLength: extended;
- ValuesMode: ValuesModeType;
- xValueLoc, yValueLoc, zValueLoc: integer;
- MenuBarHeight: integer;
- NewPicWidth, NewPicHeight: integer;
- RestoreUndoBuf: boolean;
- WhatToOpen: (OpenImage, OpenPICT2, OpenTIFF, OpenMCID, OpenUnknown, OpenImported, OpenCustom);
- WhatToImport: WhatToImportType;
- ImportCustomWidth, ImportCustomHeight: integer;
- ImportCustomOffset: LongInt;
- TiffInfo: record
- Header: TiffHdr; {8}
- nEntries: integer; {2}
- directory: array[1..7] of TiffEntry; {84}
- NextIFD: LongInt; {4}
- filler: array[1..TiffFillerSize] of integer;
- end;
- IntelByteOrder: boolean;
- BufferSize: LongInt;
- MaxScionWidth: integer;
- isSelectionTool: boolean;
- SelectionMode: (NewSelection, AddSelection, SubSelection);
- RoiMovementState: (Unconstrained, Constrained, ConstrainedH, ConstrainedV);
- pcItem: array[1..npcItems] of record
- r: rect;
- itype: pcItemType;
- str: string[20];
- end;
- PictF: integer;
- PictBuffer, curPictBufPtr: ptr;
- BytesInPictBuffer: LongInt;
- FitsInPictBuffer, RoiNudged, SavingOutline, RestoringOutline, GrayMapReady, RedoSelection: boolean;
- ThresholdingMode: (LutThresholding, GrayMapThresholding, BinaryImage);
- WandAutoMeasure, WandAutoNumber: boolean;
- RunningOn030: boolean;
- WhiteRGB, BlackRGB: RGBColor;
-
-
- implementation
-
- end.